﻿using System;
using System.Globalization;
using System.Windows.Controls;

namespace eProject.View.Validation
{
    public class CommonValidationRule<T> : AbstractValidationRule
    {
        public Predicate<T> Predicate{get; set;}
		
		
        public override ValidationResult Validate(object value, CultureInfo info)
        {
            if (value != null && value is T && Predicate != null && Predicate((T)value))
            {
                return new ValidationResult(true, null);
            }
            return new ValidationResult(false, ErrorMessage);
        }
    }

    public class StringValidationRule : CommonValidationRule<string>
    {

    }
}